// KUntar.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "KFileOperator.h"
#include "KUnpackager.h"
#include "KTarUI.h"

using namespace KTar;

void TestPackagerUnpack(void)
{
	KUnpackager kUnpackager;
	KFileOperator kFilerOperator;
	KTarUI kUI;
	kUI.Init(&wcout, &wcin);
	kUnpackager.Init(&kFilerOperator, &kUI);
	kUnpackager.Unpack("e:\\test2\\", "out.ktar", "e:\\test3\\");
}

int main(int argc, const char* argv[])
{
	TestPackagerUnpack();
	KTarUI* pkUI = new KTarUI;
	pkUI->Init(&wcout, &wcin);

	if (argc != 5)
	{
		*pkUI << "usage: unktar SRC_FOLDER SRC_FILENAME ";
		*pkUI << "DEST_FOLDER";
		delete pkUI;
		return -1;
	}

	KUnpackager* pkUnpackager = new KUnpackager;
	KFileOperator* pkFilerOperator = new KFileOperator;
	pkUnpackager->Init(pkFilerOperator, pkUI);
	pkUnpackager->Unpack(argv[1], argv[2], argv[3]);
	delete pkUnpackager;
	delete pkUI;
	delete pkFilerOperator;
	return 0;
}

